The Python time and date operations need to use the datetime and Timing standard library modules.One, Time module1.time module represents the way of time① time Stamp② formatted time string③ in the form of an array (struct_time), a total of nine
Regular formatting
The format () method of the string class is used to create formatted strings and connect multiple string objects. Readers familiar with the C language should remember the sprintf () method of the C language. The two have
ObjectiveInterpretation of related termsThe manifestation of timeTime ModuleDateTime moduleTime Format CodeSummarizeObjectiveIn the development work, we often need to use the date and time, such as:Content output as log informationCalculate the
DateCommandThe function of the date command is to display and set the system date and time.The general format for this command is: date [options] Displays the time format (beginning with +, followed by formatting)Date set time formatThe meanings of
Format dateThe first parameter of the date () function specifies how to format the date/time. It uses letters to indicate the date and time formats. Some availableLetter:• Day in d-month (01-31)• M-current month, in numbers (01-12)• Y-current year
The DateTime module defines the following classes:Datetime.date: A class that represents a date. Common attributes are the year, month, Day.datetime.time: class that represents the time. Commonly used properties are hour, minute, second, Microsecond.
Date () is a commonly used date-time function, let me summarize the date () function of the various forms of usage, there is a need to learn the friend can refer to.
Formatted dateThe first parameter of the date () function specifies how the date/
Date () is a commonly used date-time function, let me summarize the date () function of the various forms of usage, there is a need to learn the friend can refer to.Formatted dateThe first parameter of the date () function specifies how the
The function of the date command is to display and set the system date and time.
The general format for this command is: date [options] Displays the time format (beginning with +, followed by formatting)
Date set time format
The meanings of the
Date and time (asctimectimegettimeofdaygmtimelocaltimemktimesettimeofdaytimeasctime (expressed in string format) related functions time, ctime, gmtime, localtime header file # include & lt; time. h & gt; define the function char * ascti
Date and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.